package com.future.bantang.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import com.future.bantang.constants.BanTang;
import com.future.bantang.fragment.BaseFragment;
import com.future.bantang.fragment.SubFieldFragment;
import com.future.bantang.utils.L;

/**
 * Created by Administrator on 16-1-13.
 */
public class SubFieldFragmentPagerAdapter extends FragmentPagerAdapter {

    public SubFieldFragmentPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        int scene=BanTang.scenes[position];
        BaseFragment fragment=BaseFragment.getInstance(SubFieldFragment.class);
        Bundle bundle=new Bundle();
        bundle.putInt("scene",scene);
        fragment.setArguments(bundle);
        return fragment;
    }






    @Override
    public int getCount() {
        return BanTang.titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return BanTang.titles[position];
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        Object obj=super.instantiateItem(container, position);
        L.d("instantiateItem---"+obj);
        return obj;
    }
}
